-- This file is part of the Fantasy Grounds Open Foundation Ruleset project. 
-- For the latest information, see http://www.fantasygrounds.com/
--
-- Copyright 2008 SmiteWorks Ltd.
--
-- This file is provided under the Open Game License version 1.0a
-- Refer to the license.html file for the full license text
--
-- All producers of work derived from this material are advised to
-- familiarize themselves with the license, and to take special
-- care in providing the definition of Product Identity (as specified
-- by the OGL) in their products.
--
-- All material submitted to the Open Foundation Ruleset project must
-- contain this notice in a manner applicable to the source file type.


-- This is the generic representation of a combat tracker entry
-- Specific instances should inherit this, and can implement the following functions:
--   populate
--   getTokenUnderlayProperties
--   getTokenPermissions
--   handleTokenDrop


function getTracker()
	if self.windowlist and self.windowlist.window.windowlist then
		-- Group view
		return self.windowlist.window.windowlist.window;
	else
		-- Initiative view
		return self.windowlist.window;
	end
end

-- Section visibility handling

forceeffects = false;
effectson = false;

function setSpacerState()
	if self.spacer then
		if effectson then
			self.spacer.setVisible(true);
		else
			self.spacer.setVisible(false);
		end
	end
end

function setEffectsVisible(status)
	if forceeffects then
		status = true;
	end
	
	effectson = status;
	
	if self.effecticon then
		self.effecticon.setVisible(status);
	end
	if self.effects then
		self.effects.setVisible(status);
	end
	
	self.setSpacerState();
end

function toggleForceEffects(forcestate)
	if forcestate == nil then
		forceeffects = not forceeffects;
	else
		forceeffects = forcestate;
	end
	
	if self.activateeffects then
		if forceeffects then
			self.activateeffects.setColor("ffffffff");
		else
			self.activateeffects.setColor("7fffffff");
		end
	end
end

function onInit()
	setEffectsVisible(false);
end

